package com.lhd.qd.module.system.user.model.converter;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lhd.qd.module.system.user.model.dataobj.UserLoginLogDO;
import com.lhd.qd.module.system.user.model.vo.UserLoginLogListVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper
public abstract class AbstractUserLoginLogConverter {

    public static AbstractUserLoginLogConverter INSTANCE = Mappers.getMapper(AbstractUserLoginLogConverter.class);

    public abstract Page<UserLoginLogListVO> doPage2ListVOPage(IPage<UserLoginLogDO> doPage);

    @Mapping(target = "ipv4", expression = "java(com.lhd.qd.common.util.CommonUtils.long2Ip(dataObj.getIpv4()))")
    public abstract UserLoginLogListVO do2ListVO(UserLoginLogDO dataObj);
}
